/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.barrientosjunior.calculadora;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import org.netbeans.microedition.lcdui.SplashScreen;

/**
 * @author Sidnei
 */
public class SuperCalc extends MIDlet implements CommandListener {

    private boolean midletPaused = false;

    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private Command exitCommand;
    private Command exitCommand1;
    private Command backCommand;
    private Command backCommand1;
    private Command okCommand;
    private Command screenCommand;
    private Command backCommand2;
    private Command backCommand3;
    private Command okCommand1;
    private Command itemCommand;
    private Command backCommand4;
    private Command itemCommandBinToDec;
    private Command itemCommandDecToBin;
    private Command backCommand5;
    private Command itemCommand1;
    private Command okCommandPoisson;
    private Command helpCommandPoisson;
    private Command backCommand6;
    private List listMenuPrincipal;
    private List listEstatistica;
    private Form formRetaNormal;
    private TextField textFieldX;
    private TextField textFieldP;
    private TextField textFieldMiu;
    private StringItem stringItemResult;
    private TextField textFieldDP;
    private List listCientifica;
    private List listFinanceira;
    private SplashScreen splashScreen;
    private Form formDistribBinomial;
    private StringItem stringItemResult1;
    private TextField textFieldQ;
    private TextField textFieldN;
    private TextField textFieldP1;
    private TextField textFieldK;
    private List listComputacao;
    private Form formConversaoBase;
    private StringItem stringItemResultadoConversorBase;
    private TextField textFieldInputConversor;
    private Form formPoisson;
    private TextField textFieldPoissonLambda;
    private TextField textFieldPoissonK;
    private StringItem stringItemResultPoisson;
    private Alert alertAjudaPoisson;
    private Image image1;
    private Font font1;
    private Image image2;
    //</editor-fold>//GEN-END:|fields|0|

    /**
     * The SuperCalc constructor.
     */
    public SuperCalc() {
    }

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    //</editor-fold>//GEN-END:|methods|0|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">//GEN-BEGIN:|0-initialize|0|0-preInitialize
    /**
     * Initilizes the application.
     * It is called only once when the MIDlet is started. The method is called before the <code>startMIDlet</code> method.
     */
    private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
        // write pre-initialize user code here
//GEN-LINE:|0-initialize|1|0-postInitialize
        // write post-initialize user code here
    }//GEN-BEGIN:|0-initialize|2|
    //</editor-fold>//GEN-END:|0-initialize|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">//GEN-BEGIN:|3-startMIDlet|0|3-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Started point.
     */
    public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
        // write pre-action user code here
        switchDisplayable(null, getSplashScreen());//GEN-LINE:|3-startMIDlet|1|3-postAction
        // write post-action user code here
    }//GEN-BEGIN:|3-startMIDlet|2|
    //</editor-fold>//GEN-END:|3-startMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">//GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
     */
    public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
        // write pre-action user code here
//GEN-LINE:|4-resumeMIDlet|1|4-postAction
        // write post-action user code here
    }//GEN-BEGIN:|4-resumeMIDlet|2|
    //</editor-fold>//GEN-END:|4-resumeMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">//GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
    /**
     * Switches a current displayable in a display. The <code>display</code> instance is taken from <code>getDisplay</code> method. This method is used by all actions in the design for switching displayable.
     * @param alert the Alert which is temporarily set to the display; if <code>null</code>, then <code>nextDisplayable</code> is set immediately
     * @param nextDisplayable the Displayable to be set
     */
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
        // write pre-switch user code here
        Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }//GEN-END:|5-switchDisplayable|1|5-postSwitch
        // write post-switch user code here
    }//GEN-BEGIN:|5-switchDisplayable|2|
    //</editor-fold>//GEN-END:|5-switchDisplayable|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Displayables ">//GEN-BEGIN:|7-commandAction|0|7-preCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular displayable.
     * @param command the Command that was invoked
     * @param displayable the Displayable where the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
        // write pre-action user code here
        if (displayable == alertAjudaPoisson) {//GEN-BEGIN:|7-commandAction|1|142-preAction
            if (command == backCommand6) {//GEN-END:|7-commandAction|1|142-preAction
                // write pre-action user code here
                switchDisplayable(null, getFormPoisson());//GEN-LINE:|7-commandAction|2|142-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|3|113-preAction
        } else if (displayable == formConversaoBase) {
            if (command == backCommand5) {//GEN-END:|7-commandAction|3|113-preAction
                // write pre-action user code here
                switchDisplayable(null, getListComputacao());//GEN-LINE:|7-commandAction|4|113-postAction
                // write post-action user code here
            } else if (command == itemCommandBinToDec) {//GEN-LINE:|7-commandAction|5|110-preAction
                // write pre-action user code here
                this.stringItemResultadoConversorBase.setText(
                        Integer.toString(
                            Computacao.fromBinToDecimal(
                                this.textFieldInputConversor.getString())));
//GEN-LINE:|7-commandAction|6|110-postAction
                // write post-action user code here
            } else if (command == itemCommandDecToBin) {//GEN-LINE:|7-commandAction|7|108-preAction
                // write pre-action user code here
                this.stringItemResultadoConversorBase.setText(
                        Computacao.fromDecimalToBin(
                            Integer.parseInt(
                                this.textFieldInputConversor.getString())));
//GEN-LINE:|7-commandAction|8|108-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|9|86-preAction
        } else if (displayable == formDistribBinomial) {
            if (command == backCommand1) {//GEN-END:|7-commandAction|9|86-preAction
                // write pre-action user code here
                switchDisplayable(null, getListEstatistica());//GEN-LINE:|7-commandAction|10|86-postAction
                // write post-action user code here
            } else if (command == okCommand1) {//GEN-LINE:|7-commandAction|11|88-preAction
                calculaDistribuicaoBinomial();
//GEN-LINE:|7-commandAction|12|88-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|13|133-preAction
        } else if (displayable == formPoisson) {
            if (command == backCommand1) {//GEN-END:|7-commandAction|13|133-preAction
                // write pre-action user code here
                switchDisplayable(null, getListEstatistica());//GEN-LINE:|7-commandAction|14|133-postAction
                // write post-action user code here
            } else if (command == helpCommandPoisson) {//GEN-LINE:|7-commandAction|15|127-preAction
                // write pre-action user code here
                switchDisplayable(getAlertAjudaPoisson(), getFormPoisson());//GEN-LINE:|7-commandAction|16|127-postAction
                // write post-action user code here
            } else if (command == okCommandPoisson) {//GEN-LINE:|7-commandAction|17|125-preAction
                calculaPoisson();
//GEN-LINE:|7-commandAction|18|125-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|19|44-preAction
        } else if (displayable == formRetaNormal) {
            if (command == backCommand1) {//GEN-END:|7-commandAction|19|44-preAction
                // write pre-action user code here
                switchDisplayable(null, getListEstatistica());//GEN-LINE:|7-commandAction|20|44-postAction
                // write post-action user code here
            } else if (command == okCommand) {//GEN-LINE:|7-commandAction|21|50-preAction
                calculaValorZRetaNormal();
//GEN-LINE:|7-commandAction|22|50-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|23|56-preAction
        } else if (displayable == listCientifica) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|23|56-preAction
                // write pre-action user code here
                listCientificaAction();//GEN-LINE:|7-commandAction|24|56-postAction
                // write post-action user code here
            } else if (command == backCommand3) {//GEN-LINE:|7-commandAction|25|68-preAction
                // write pre-action user code here
                switchDisplayable(null, getListMenuPrincipal());//GEN-LINE:|7-commandAction|26|68-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|27|98-preAction
        } else if (displayable == listComputacao) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|27|98-preAction
                // write pre-action user code here
                listComputacaoAction();//GEN-LINE:|7-commandAction|28|98-postAction
                // write post-action user code here
            } else if (command == backCommand4) {//GEN-LINE:|7-commandAction|29|102-preAction
                // write pre-action user code here
                switchDisplayable(null, getListMenuPrincipal());//GEN-LINE:|7-commandAction|30|102-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|31|33-preAction
        } else if (displayable == listEstatistica) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|31|33-preAction
                // write pre-action user code here
                listEstatisticaAction();//GEN-LINE:|7-commandAction|32|33-postAction
                // write post-action user code here
            } else if (command == backCommand) {//GEN-LINE:|7-commandAction|33|36-preAction
                // write pre-action user code here
                switchDisplayable(null, getListMenuPrincipal());//GEN-LINE:|7-commandAction|34|36-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|35|59-preAction
        } else if (displayable == listFinanceira) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|35|59-preAction
                // write pre-action user code here
                listFinanceiraAction();//GEN-LINE:|7-commandAction|36|59-postAction
                // write post-action user code here
            } else if (command == backCommand2) {//GEN-LINE:|7-commandAction|37|62-preAction
                // write pre-action user code here
                switchDisplayable(null, getListMenuPrincipal());//GEN-LINE:|7-commandAction|38|62-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|39|24-preAction
        } else if (displayable == listMenuPrincipal) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|39|24-preAction
                // write pre-action user code here
                listMenuPrincipalAction();//GEN-LINE:|7-commandAction|40|24-postAction
                // write post-action user code here
            } else if (command == exitCommand1) {//GEN-LINE:|7-commandAction|41|30-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|42|30-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|43|72-preAction
        } else if (displayable == splashScreen) {
            if (command == SplashScreen.DISMISS_COMMAND) {//GEN-END:|7-commandAction|43|72-preAction
                // write pre-action user code here
                switchDisplayable(null, getListMenuPrincipal());//GEN-LINE:|7-commandAction|44|72-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|45|7-postCommandAction
        }//GEN-END:|7-commandAction|45|7-postCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|7-commandAction|46|
    //</editor-fold>//GEN-END:|7-commandAction|46|


    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand ">//GEN-BEGIN:|18-getter|0|18-preInit
    /**
     * Returns an initiliazed instance of exitCommand component.
     * @return the initialized component instance
     */
    public Command getExitCommand() {
        if (exitCommand == null) {//GEN-END:|18-getter|0|18-preInit
            // write pre-init user code here
            exitCommand = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|18-getter|1|18-postInit
            // write post-init user code here
        }//GEN-BEGIN:|18-getter|2|
        return exitCommand;
    }
    //</editor-fold>//GEN-END:|18-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand1 ">//GEN-BEGIN:|29-getter|0|29-preInit
    /**
     * Returns an initiliazed instance of exitCommand1 component.
     * @return the initialized component instance
     */
    public Command getExitCommand1() {
        if (exitCommand1 == null) {//GEN-END:|29-getter|0|29-preInit
            // write pre-init user code here
            exitCommand1 = new Command("Sair", Command.EXIT, 0);//GEN-LINE:|29-getter|1|29-postInit
            // write post-init user code here
        }//GEN-BEGIN:|29-getter|2|
        return exitCommand1;
    }
    //</editor-fold>//GEN-END:|29-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand ">//GEN-BEGIN:|35-getter|0|35-preInit
    /**
     * Returns an initiliazed instance of backCommand component.
     * @return the initialized component instance
     */
    public Command getBackCommand() {
        if (backCommand == null) {//GEN-END:|35-getter|0|35-preInit
            // write pre-init user code here
            backCommand = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|35-getter|1|35-postInit
            // write post-init user code here
        }//GEN-BEGIN:|35-getter|2|
        return backCommand;
    }
    //</editor-fold>//GEN-END:|35-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: listMenuPrincipal ">//GEN-BEGIN:|22-getter|0|22-preInit
    /**
     * Returns an initiliazed instance of listMenuPrincipal component.
     * @return the initialized component instance
     */
    public List getListMenuPrincipal() {
        if (listMenuPrincipal == null) {//GEN-END:|22-getter|0|22-preInit
            // write pre-init user code here
            listMenuPrincipal = new List("MenuPrincipal", Choice.IMPLICIT);//GEN-BEGIN:|22-getter|1|22-postInit
            listMenuPrincipal.append("Estatistica", null);
            listMenuPrincipal.append("Financeira", null);
            listMenuPrincipal.append("Cient\u00EDfica", null);
            listMenuPrincipal.append("Computa\u00E7\u00E3o", null);
            listMenuPrincipal.append("Sobre...", null);
            listMenuPrincipal.addCommand(getExitCommand1());
            listMenuPrincipal.setCommandListener(this);
            listMenuPrincipal.setSelectedFlags(new boolean[] { false, false, false, false, false });
            listMenuPrincipal.setFont(0, getFont1());
            listMenuPrincipal.setFont(1, getFont1());
            listMenuPrincipal.setFont(2, getFont1());
            listMenuPrincipal.setFont(3, getFont1());
            listMenuPrincipal.setFont(4, getFont1());//GEN-END:|22-getter|1|22-postInit
            // write post-init user code here
        }//GEN-BEGIN:|22-getter|2|
        return listMenuPrincipal;
    }
    //</editor-fold>//GEN-END:|22-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: listMenuPrincipalAction ">//GEN-BEGIN:|22-action|0|22-preAction
    /**
     * Performs an action assigned to the selected list element in the listMenuPrincipal component.
     */
    public void listMenuPrincipalAction() {//GEN-END:|22-action|0|22-preAction
        // enter pre-action user code here
        String __selectedString = getListMenuPrincipal().getString(getListMenuPrincipal().getSelectedIndex());//GEN-BEGIN:|22-action|1|26-preAction
        if (__selectedString != null) {
            if (__selectedString.equals("Estatistica")) {//GEN-END:|22-action|1|26-preAction
                // write pre-action user code here
                switchDisplayable(null, getListEstatistica());//GEN-LINE:|22-action|2|26-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Financeira")) {//GEN-LINE:|22-action|3|52-preAction
                // write pre-action user code here
                switchDisplayable(null, getListFinanceira());//GEN-LINE:|22-action|4|52-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Cient\u00EDfica")) {//GEN-LINE:|22-action|5|53-preAction
                // write pre-action user code here
                switchDisplayable(null, getListCientifica());//GEN-LINE:|22-action|6|53-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Computa\u00E7\u00E3o")) {//GEN-LINE:|22-action|7|96-preAction
                // write pre-action user code here
                switchDisplayable(null, getListComputacao());//GEN-LINE:|22-action|8|96-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Sobre...")) {//GEN-LINE:|22-action|9|116-preAction
                // write pre-action user code here
//GEN-LINE:|22-action|10|116-postAction
                // write post-action user code here
            }//GEN-BEGIN:|22-action|11|22-postAction
        }//GEN-END:|22-action|11|22-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|22-action|12|
    //</editor-fold>//GEN-END:|22-action|12|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: listEstatistica ">//GEN-BEGIN:|32-getter|0|32-preInit
    /**
     * Returns an initiliazed instance of listEstatistica component.
     * @return the initialized component instance
     */
    public List getListEstatistica() {
        if (listEstatistica == null) {//GEN-END:|32-getter|0|32-preInit
            // write pre-init user code here
            listEstatistica = new List("Estatistica", Choice.IMPLICIT);//GEN-BEGIN:|32-getter|1|32-postInit
            listEstatistica.append("Curva Normal", null);
            listEstatistica.append("Distribui\u00E7\u00E3o Binomial", null);
            listEstatistica.append("Distribui\u00E7\u00E3o de Poisson", null);
            listEstatistica.addCommand(getBackCommand());
            listEstatistica.setCommandListener(this);
            listEstatistica.setSelectedFlags(new boolean[] { false, false, false });//GEN-END:|32-getter|1|32-postInit
            // write post-init user code here
        }//GEN-BEGIN:|32-getter|2|
        return listEstatistica;
    }
    //</editor-fold>//GEN-END:|32-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: listEstatisticaAction ">//GEN-BEGIN:|32-action|0|32-preAction
    /**
     * Performs an action assigned to the selected list element in the listEstatistica component.
     */
    public void listEstatisticaAction() {//GEN-END:|32-action|0|32-preAction
        // enter pre-action user code here
        String __selectedString = getListEstatistica().getString(getListEstatistica().getSelectedIndex());//GEN-BEGIN:|32-action|1|38-preAction
        if (__selectedString != null) {
            if (__selectedString.equals("Curva Normal")) {//GEN-END:|32-action|1|38-preAction
                // write pre-action user code here
                switchDisplayable(null, getFormRetaNormal());//GEN-LINE:|32-action|2|38-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Distribui\u00E7\u00E3o Binomial")) {//GEN-LINE:|32-action|3|92-preAction
                // write pre-action user code here
                switchDisplayable(null, getFormDistribBinomial());//GEN-LINE:|32-action|4|92-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Distribui\u00E7\u00E3o de Poisson")) {//GEN-LINE:|32-action|5|117-preAction
                // write pre-action user code here
                switchDisplayable(null, getFormPoisson());//GEN-LINE:|32-action|6|117-postAction
                // write post-action user code here
            }//GEN-BEGIN:|32-action|7|32-postAction
        }//GEN-END:|32-action|7|32-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|32-action|8|
    //</editor-fold>//GEN-END:|32-action|8|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: formRetaNormal ">//GEN-BEGIN:|39-getter|0|39-preInit
    /**
     * Returns an initiliazed instance of formRetaNormal component.
     * @return the initialized component instance
     */
    public Form getFormRetaNormal() {
        if (formRetaNormal == null) {//GEN-END:|39-getter|0|39-preInit
            // write pre-init user code here
            formRetaNormal = new Form("Valor Z da reta normal", new Item[] { getTextFieldX(), getTextFieldP(), getTextFieldMiu(), getTextFieldDP(), getStringItemResult() });//GEN-BEGIN:|39-getter|1|39-postInit
            formRetaNormal.addCommand(getBackCommand1());
            formRetaNormal.addCommand(getOkCommand());
            formRetaNormal.setCommandListener(this);//GEN-END:|39-getter|1|39-postInit
            // write post-init user code here
        }//GEN-BEGIN:|39-getter|2|
        return formRetaNormal;
    }
    //</editor-fold>//GEN-END:|39-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldX ">//GEN-BEGIN:|40-getter|0|40-preInit
    /**
     * Returns an initiliazed instance of textFieldX component.
     * @return the initialized component instance
     */
    public TextField getTextFieldX() {
        if (textFieldX == null) {//GEN-END:|40-getter|0|40-preInit
            // write pre-init user code here
            textFieldX = new TextField("X:", null, 32, TextField.ANY);//GEN-LINE:|40-getter|1|40-postInit
            // write post-init user code here
        }//GEN-BEGIN:|40-getter|2|
        return textFieldX;
    }
    //</editor-fold>//GEN-END:|40-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand1 ">//GEN-BEGIN:|43-getter|0|43-preInit
    /**
     * Returns an initiliazed instance of backCommand1 component.
     * @return the initialized component instance
     */
    public Command getBackCommand1() {
        if (backCommand1 == null) {//GEN-END:|43-getter|0|43-preInit
            // write pre-init user code here
            backCommand1 = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|43-getter|1|43-postInit
            // write post-init user code here
        }//GEN-BEGIN:|43-getter|2|
        return backCommand1;
    }
    //</editor-fold>//GEN-END:|43-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand ">//GEN-BEGIN:|49-getter|0|49-preInit
    /**
     * Returns an initiliazed instance of okCommand component.
     * @return the initialized component instance
     */
    public Command getOkCommand() {
        if (okCommand == null) {//GEN-END:|49-getter|0|49-preInit
            // write pre-init user code here
            okCommand = new Command("Calcular", Command.OK, 0);//GEN-LINE:|49-getter|1|49-postInit

        }//GEN-BEGIN:|49-getter|2|
        return okCommand;
    }
    //</editor-fold>//GEN-END:|49-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldP ">//GEN-BEGIN:|46-getter|0|46-preInit
    /**
     * Returns an initiliazed instance of textFieldP component.
     * @return the initialized component instance
     */
    public TextField getTextFieldP() {
        if (textFieldP == null) {//GEN-END:|46-getter|0|46-preInit
            // write pre-init user code here
            textFieldP = new TextField("Valor P(deslocamento 0.5 ou -0.5):", null, 32, TextField.ANY);//GEN-LINE:|46-getter|1|46-postInit
            // write post-init user code here
        }//GEN-BEGIN:|46-getter|2|
        return textFieldP;
    }
    //</editor-fold>//GEN-END:|46-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldMiu ">//GEN-BEGIN:|47-getter|0|47-preInit
    /**
     * Returns an initiliazed instance of textFieldMiu component.
     * @return the initialized component instance
     */
    public TextField getTextFieldMiu() {
        if (textFieldMiu == null) {//GEN-END:|47-getter|0|47-preInit
            // write pre-init user code here
            textFieldMiu = new TextField("Valor Esperado (Miu):", null, 32, TextField.ANY);//GEN-LINE:|47-getter|1|47-postInit
            // write post-init user code here
        }//GEN-BEGIN:|47-getter|2|
        return textFieldMiu;
    }
    //</editor-fold>//GEN-END:|47-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldDP ">//GEN-BEGIN:|48-getter|0|48-preInit
    /**
     * Returns an initiliazed instance of textFieldDP component.
     * @return the initialized component instance
     */
    public TextField getTextFieldDP() {
        if (textFieldDP == null) {//GEN-END:|48-getter|0|48-preInit
            // write pre-init user code here
            textFieldDP = new TextField("Desvio Padr\u00E3o(Sigma):", null, 32, TextField.ANY);//GEN-LINE:|48-getter|1|48-postInit
            // write post-init user code here
        }//GEN-BEGIN:|48-getter|2|
        return textFieldDP;
    }
    //</editor-fold>//GEN-END:|48-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItemResult ">//GEN-BEGIN:|51-getter|0|51-preInit
    /**
     * Returns an initiliazed instance of stringItemResult component.
     * @return the initialized component instance
     */
    public StringItem getStringItemResult() {
        if (stringItemResult == null) {//GEN-END:|51-getter|0|51-preInit
            // write pre-init user code here
            stringItemResult = new StringItem("Resultado:", null);//GEN-LINE:|51-getter|1|51-postInit
            // write post-init user code here
        }//GEN-BEGIN:|51-getter|2|
        return stringItemResult;
    }
    //</editor-fold>//GEN-END:|51-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: screenCommand ">//GEN-BEGIN:|54-getter|0|54-preInit
    /**
     * Returns an initiliazed instance of screenCommand component.
     * @return the initialized component instance
     */
    public Command getScreenCommand() {
        if (screenCommand == null) {//GEN-END:|54-getter|0|54-preInit
            // write pre-init user code here
            screenCommand = new Command("Tela", Command.SCREEN, 0);//GEN-LINE:|54-getter|1|54-postInit
            // write post-init user code here
        }//GEN-BEGIN:|54-getter|2|
        return screenCommand;
    }
    //</editor-fold>//GEN-END:|54-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand2 ">//GEN-BEGIN:|61-getter|0|61-preInit
    /**
     * Returns an initiliazed instance of backCommand2 component.
     * @return the initialized component instance
     */
    public Command getBackCommand2() {
        if (backCommand2 == null) {//GEN-END:|61-getter|0|61-preInit
            // write pre-init user code here
            backCommand2 = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|61-getter|1|61-postInit
            // write post-init user code here
        }//GEN-BEGIN:|61-getter|2|
        return backCommand2;
    }
    //</editor-fold>//GEN-END:|61-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand3 ">//GEN-BEGIN:|67-getter|0|67-preInit
    /**
     * Returns an initiliazed instance of backCommand3 component.
     * @return the initialized component instance
     */
    public Command getBackCommand3() {
        if (backCommand3 == null) {//GEN-END:|67-getter|0|67-preInit
            // write pre-init user code here
            backCommand3 = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|67-getter|1|67-postInit
            // write post-init user code here
        }//GEN-BEGIN:|67-getter|2|
        return backCommand3;
    }
    //</editor-fold>//GEN-END:|67-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: listCientifica ">//GEN-BEGIN:|55-getter|0|55-preInit
    /**
     * Returns an initiliazed instance of listCientifica component.
     * @return the initialized component instance
     */
    public List getListCientifica() {
        if (listCientifica == null) {//GEN-END:|55-getter|0|55-preInit
            // write pre-init user code here
            listCientifica = new List("Cientifica", Choice.IMPLICIT);//GEN-BEGIN:|55-getter|1|55-postInit
            listCientifica.addCommand(getBackCommand3());
            listCientifica.setCommandListener(this);//GEN-END:|55-getter|1|55-postInit
            // write post-init user code here
        }//GEN-BEGIN:|55-getter|2|
        return listCientifica;
    }
    //</editor-fold>//GEN-END:|55-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: listCientificaAction ">//GEN-BEGIN:|55-action|0|55-preAction
    /**
     * Performs an action assigned to the selected list element in the listCientifica component.
     */
    public void listCientificaAction() {//GEN-END:|55-action|0|55-preAction
        // enter pre-action user code here
        String __selectedString = getListCientifica().getString(getListCientifica().getSelectedIndex());//GEN-LINE:|55-action|1|55-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|55-action|2|
    //</editor-fold>//GEN-END:|55-action|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: listFinanceira ">//GEN-BEGIN:|58-getter|0|58-preInit
    /**
     * Returns an initiliazed instance of listFinanceira component.
     * @return the initialized component instance
     */
    public List getListFinanceira() {
        if (listFinanceira == null) {//GEN-END:|58-getter|0|58-preInit
            // write pre-init user code here
            listFinanceira = new List("Financeira", Choice.IMPLICIT);//GEN-BEGIN:|58-getter|1|58-postInit
            listFinanceira.append("Juros Simples", null);
            listFinanceira.append("Juros Compostos", null);
            listFinanceira.addCommand(getBackCommand2());
            listFinanceira.setCommandListener(this);
            listFinanceira.setSelectedFlags(new boolean[] { false, false });//GEN-END:|58-getter|1|58-postInit
            // write post-init user code here
        }//GEN-BEGIN:|58-getter|2|
        return listFinanceira;
    }
    //</editor-fold>//GEN-END:|58-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: listFinanceiraAction ">//GEN-BEGIN:|58-action|0|58-preAction
    /**
     * Performs an action assigned to the selected list element in the listFinanceira component.
     */
    public void listFinanceiraAction() {//GEN-END:|58-action|0|58-preAction
        // enter pre-action user code here
        String __selectedString = getListFinanceira().getString(getListFinanceira().getSelectedIndex());//GEN-BEGIN:|58-action|1|94-preAction
        if (__selectedString != null) {
            if (__selectedString.equals("Juros Simples")) {//GEN-END:|58-action|1|94-preAction
                // write pre-action user code here
//GEN-LINE:|58-action|2|94-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Juros Compostos")) {//GEN-LINE:|58-action|3|95-preAction
                // write pre-action user code here
//GEN-LINE:|58-action|4|95-postAction
                // write post-action user code here
            }//GEN-BEGIN:|58-action|5|58-postAction
        }//GEN-END:|58-action|5|58-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|58-action|6|
    //</editor-fold>//GEN-END:|58-action|6|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: splashScreen ">//GEN-BEGIN:|70-getter|0|70-preInit
    /**
     * Returns an initiliazed instance of splashScreen component.
     * @return the initialized component instance
     */
    public SplashScreen getSplashScreen() {
        if (splashScreen == null) {//GEN-END:|70-getter|0|70-preInit
            // write pre-init user code here
            splashScreen = new SplashScreen(getDisplay());//GEN-BEGIN:|70-getter|1|70-postInit
            splashScreen.setTitle("splashScreen");
            splashScreen.setCommandListener(this);
            splashScreen.setImage(getImage1());//GEN-END:|70-getter|1|70-postInit
            // write post-init user code here
        }//GEN-BEGIN:|70-getter|2|
        return splashScreen;
    }
    //</editor-fold>//GEN-END:|70-getter|2|







    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image1 ">//GEN-BEGIN:|78-getter|0|78-preInit
    /**
     * Returns an initiliazed instance of image1 component.
     * @return the initialized component instance
     */
    public Image getImage1() {
        if (image1 == null) {//GEN-END:|78-getter|0|78-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|78-getter|1|78-@java.io.IOException
                image1 = Image.createImage("/SuperCalc2.jpg");
            } catch (java.io.IOException e) {//GEN-END:|78-getter|1|78-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|78-getter|2|78-postInit
            // write post-init user code here
        }//GEN-BEGIN:|78-getter|3|
        return image1;
    }
    //</editor-fold>//GEN-END:|78-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: font1 ">//GEN-BEGIN:|79-getter|0|79-preInit
    /**
     * Returns an initiliazed instance of font1 component.
     * @return the initialized component instance
     */
    public Font getFont1() {
        if (font1 == null) {//GEN-END:|79-getter|0|79-preInit
            // write pre-init user code here
            font1 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE);//GEN-LINE:|79-getter|1|79-postInit
            // write post-init user code here
        }//GEN-BEGIN:|79-getter|2|
        return font1;
    }
    //</editor-fold>//GEN-END:|79-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand1 ">//GEN-BEGIN:|87-getter|0|87-preInit
    /**
     * Returns an initiliazed instance of okCommand1 component.
     * @return the initialized component instance
     */
    public Command getOkCommand1() {
        if (okCommand1 == null) {//GEN-END:|87-getter|0|87-preInit
            // write pre-init user code here
            okCommand1 = new Command("Calcular", Command.OK, 0);//GEN-LINE:|87-getter|1|87-postInit
            // write post-init user code here
        }//GEN-BEGIN:|87-getter|2|
        return okCommand1;
    }
    //</editor-fold>//GEN-END:|87-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: formDistribBinomial ">//GEN-BEGIN:|80-getter|0|80-preInit
    /**
     * Returns an initiliazed instance of formDistribBinomial component.
     * @return the initialized component instance
     */
    public Form getFormDistribBinomial() {
        if (formDistribBinomial == null) {//GEN-END:|80-getter|0|80-preInit
            // write pre-init user code here
            formDistribBinomial = new Form("Distribui\u00E7\u00E3o Binomial", new Item[] { getTextFieldN(), getTextFieldK(), getTextFieldP1(), getTextFieldQ(), getStringItemResult1() });//GEN-BEGIN:|80-getter|1|80-postInit
            formDistribBinomial.addCommand(getBackCommand1());
            formDistribBinomial.addCommand(getOkCommand1());
            formDistribBinomial.setCommandListener(this);//GEN-END:|80-getter|1|80-postInit
            // write post-init user code here
        }//GEN-BEGIN:|80-getter|2|
        return formDistribBinomial;
    }
    //</editor-fold>//GEN-END:|80-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldN ">//GEN-BEGIN:|81-getter|0|81-preInit
    /**
     * Returns an initiliazed instance of textFieldN component.
     * @return the initialized component instance
     */
    public TextField getTextFieldN() {
        if (textFieldN == null) {//GEN-END:|81-getter|0|81-preInit
            // write pre-init user code here
            textFieldN = new TextField("Numero de Ocorrencias(N)", null, 32, TextField.ANY);//GEN-LINE:|81-getter|1|81-postInit
            // write post-init user code here
        }//GEN-BEGIN:|81-getter|2|
        return textFieldN;
    }
    //</editor-fold>//GEN-END:|81-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldK ">//GEN-BEGIN:|82-getter|0|82-preInit
    /**
     * Returns an initiliazed instance of textFieldK component.
     * @return the initialized component instance
     */
    public TextField getTextFieldK() {
        if (textFieldK == null) {//GEN-END:|82-getter|0|82-preInit
            // write pre-init user code here
            textFieldK = new TextField("Numero de sucessos(K)", null, 32, TextField.ANY);//GEN-LINE:|82-getter|1|82-postInit
            // write post-init user code here
        }//GEN-BEGIN:|82-getter|2|
        return textFieldK;
    }
    //</editor-fold>//GEN-END:|82-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldP1 ">//GEN-BEGIN:|83-getter|0|83-preInit
    /**
     * Returns an initiliazed instance of textFieldP1 component.
     * @return the initialized component instance
     */
    public TextField getTextFieldP1() {
        if (textFieldP1 == null) {//GEN-END:|83-getter|0|83-preInit
            // write pre-init user code here
            textFieldP1 = new TextField("Probabilidade de Sucesso(P)", null, 32, TextField.ANY);//GEN-LINE:|83-getter|1|83-postInit
            // write post-init user code here
        }//GEN-BEGIN:|83-getter|2|
        return textFieldP1;
    }
    //</editor-fold>//GEN-END:|83-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldQ ">//GEN-BEGIN:|84-getter|0|84-preInit
    /**
     * Returns an initiliazed instance of textFieldQ component.
     * @return the initialized component instance
     */
    public TextField getTextFieldQ() {
        if (textFieldQ == null) {//GEN-END:|84-getter|0|84-preInit
            // write pre-init user code here
            textFieldQ = new TextField("Probabilidade de Fracasso(Q)", null, 32, TextField.ANY);//GEN-LINE:|84-getter|1|84-postInit
            // write post-init user code here
        }//GEN-BEGIN:|84-getter|2|
        return textFieldQ;
    }
    //</editor-fold>//GEN-END:|84-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItemResult1 ">//GEN-BEGIN:|85-getter|0|85-preInit
    /**
     * Returns an initiliazed instance of stringItemResult1 component.
     * @return the initialized component instance
     */
    public StringItem getStringItemResult1() {
        if (stringItemResult1 == null) {//GEN-END:|85-getter|0|85-preInit
            // write pre-init user code here
            stringItemResult1 = new StringItem("Resultado:", null);//GEN-LINE:|85-getter|1|85-postInit
            // write post-init user code here
        }//GEN-BEGIN:|85-getter|2|
        return stringItemResult1;
    }
    //</editor-fold>//GEN-END:|85-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: itemCommand ">//GEN-BEGIN:|90-getter|0|90-preInit
    /**
     * Returns an initiliazed instance of itemCommand component.
     * @return the initialized component instance
     */
    public Command getItemCommand() {
        if (itemCommand == null) {//GEN-END:|90-getter|0|90-preInit
            // write pre-init user code here
            itemCommand = new Command("Item", Command.ITEM, 0);//GEN-LINE:|90-getter|1|90-postInit
            // write post-init user code here
        }//GEN-BEGIN:|90-getter|2|
        return itemCommand;
    }
    //</editor-fold>//GEN-END:|90-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand4 ">//GEN-BEGIN:|101-getter|0|101-preInit
    /**
     * Returns an initiliazed instance of backCommand4 component.
     * @return the initialized component instance
     */
    public Command getBackCommand4() {
        if (backCommand4 == null) {//GEN-END:|101-getter|0|101-preInit
            // write pre-init user code here
            backCommand4 = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|101-getter|1|101-postInit
            // write post-init user code here
        }//GEN-BEGIN:|101-getter|2|
        return backCommand4;
    }
    //</editor-fold>//GEN-END:|101-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: listComputacao ">//GEN-BEGIN:|97-getter|0|97-preInit
    /**
     * Returns an initiliazed instance of listComputacao component.
     * @return the initialized component instance
     */
    public List getListComputacao() {
        if (listComputacao == null) {//GEN-END:|97-getter|0|97-preInit
            // write pre-init user code here
            listComputacao = new List("Computacao", Choice.IMPLICIT);//GEN-BEGIN:|97-getter|1|97-postInit
            listComputacao.append("Convers\u00E3o N\u00B0 Binarios", null);
            listComputacao.addCommand(getBackCommand4());
            listComputacao.setCommandListener(this);
            listComputacao.setSelectedFlags(new boolean[] { false });//GEN-END:|97-getter|1|97-postInit
            // write post-init user code here
        }//GEN-BEGIN:|97-getter|2|
        return listComputacao;
    }
    //</editor-fold>//GEN-END:|97-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: listComputacaoAction ">//GEN-BEGIN:|97-action|0|97-preAction
    /**
     * Performs an action assigned to the selected list element in the listComputacao component.
     */
    public void listComputacaoAction() {//GEN-END:|97-action|0|97-preAction
        // enter pre-action user code here
        String __selectedString = getListComputacao().getString(getListComputacao().getSelectedIndex());//GEN-BEGIN:|97-action|1|100-preAction
        if (__selectedString != null) {
            if (__selectedString.equals("Convers\u00E3o N\u00B0 Binarios")) {//GEN-END:|97-action|1|100-preAction
                // write pre-action user code here
                switchDisplayable(null, getFormConversaoBase());//GEN-LINE:|97-action|2|100-postAction
                // write post-action user code here
            }//GEN-BEGIN:|97-action|3|97-postAction
        }//GEN-END:|97-action|3|97-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|97-action|4|
    //</editor-fold>//GEN-END:|97-action|4|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: formConversaoBase ">//GEN-BEGIN:|104-getter|0|104-preInit
    /**
     * Returns an initiliazed instance of formConversaoBase component.
     * @return the initialized component instance
     */
    public Form getFormConversaoBase() {
        if (formConversaoBase == null) {//GEN-END:|104-getter|0|104-preInit
            // write pre-init user code here
            formConversaoBase = new Form("Conversao de Base", new Item[] { getTextFieldInputConversor(), getStringItemResultadoConversorBase() });//GEN-BEGIN:|104-getter|1|104-postInit
            formConversaoBase.addCommand(getItemCommandDecToBin());
            formConversaoBase.addCommand(getItemCommandBinToDec());
            formConversaoBase.addCommand(getBackCommand5());
            formConversaoBase.setCommandListener(this);//GEN-END:|104-getter|1|104-postInit
            // write post-init user code here
        }//GEN-BEGIN:|104-getter|2|
        return formConversaoBase;
    }
    //</editor-fold>//GEN-END:|104-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: itemCommandDecToBin ">//GEN-BEGIN:|107-getter|0|107-preInit
    /**
     * Returns an initiliazed instance of itemCommandDecToBin component.
     * @return the initialized component instance
     */
    public Command getItemCommandDecToBin() {
        if (itemCommandDecToBin == null) {//GEN-END:|107-getter|0|107-preInit
            // write pre-init user code here
            itemCommandDecToBin = new Command("Decimal>Binario", Command.ITEM, 0);//GEN-LINE:|107-getter|1|107-postInit
            // write post-init user code here
        }//GEN-BEGIN:|107-getter|2|
        return itemCommandDecToBin;
    }
    //</editor-fold>//GEN-END:|107-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: itemCommandBinToDec ">//GEN-BEGIN:|109-getter|0|109-preInit
    /**
     * Returns an initiliazed instance of itemCommandBinToDec component.
     * @return the initialized component instance
     */
    public Command getItemCommandBinToDec() {
        if (itemCommandBinToDec == null) {//GEN-END:|109-getter|0|109-preInit
            // write pre-init user code here
            itemCommandBinToDec = new Command("Binario>Decimal", Command.ITEM, 0);//GEN-LINE:|109-getter|1|109-postInit
            // write post-init user code here
        }//GEN-BEGIN:|109-getter|2|
        return itemCommandBinToDec;
    }
    //</editor-fold>//GEN-END:|109-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldInputConversor ">//GEN-BEGIN:|105-getter|0|105-preInit
    /**
     * Returns an initiliazed instance of textFieldInputConversor component.
     * @return the initialized component instance
     */
    public TextField getTextFieldInputConversor() {
        if (textFieldInputConversor == null) {//GEN-END:|105-getter|0|105-preInit
            // write pre-init user code here
            textFieldInputConversor = new TextField("Valor Input:", null, 32, TextField.ANY);//GEN-LINE:|105-getter|1|105-postInit
            // write post-init user code here
        }//GEN-BEGIN:|105-getter|2|
        return textFieldInputConversor;
    }
    //</editor-fold>//GEN-END:|105-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItemResultadoConversorBase ">//GEN-BEGIN:|106-getter|0|106-preInit
    /**
     * Returns an initiliazed instance of stringItemResultadoConversorBase component.
     * @return the initialized component instance
     */
    public StringItem getStringItemResultadoConversorBase() {
        if (stringItemResultadoConversorBase == null) {//GEN-END:|106-getter|0|106-preInit
            // write pre-init user code here
            stringItemResultadoConversorBase = new StringItem("Resultado:", null);//GEN-LINE:|106-getter|1|106-postInit
            // write post-init user code here
        }//GEN-BEGIN:|106-getter|2|
        return stringItemResultadoConversorBase;
    }
    //</editor-fold>//GEN-END:|106-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand5 ">//GEN-BEGIN:|112-getter|0|112-preInit
    /**
     * Returns an initiliazed instance of backCommand5 component.
     * @return the initialized component instance
     */
    public Command getBackCommand5() {
        if (backCommand5 == null) {//GEN-END:|112-getter|0|112-preInit
            // write pre-init user code here
            backCommand5 = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|112-getter|1|112-postInit
            // write post-init user code here
        }//GEN-BEGIN:|112-getter|2|
        return backCommand5;
    }
    //</editor-fold>//GEN-END:|112-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: itemCommand1 ">//GEN-BEGIN:|122-getter|0|122-preInit
    /**
     * Returns an initiliazed instance of itemCommand1 component.
     * @return the initialized component instance
     */
    public Command getItemCommand1() {
        if (itemCommand1 == null) {//GEN-END:|122-getter|0|122-preInit
            // write pre-init user code here
            itemCommand1 = new Command("Item", Command.ITEM, 0);//GEN-LINE:|122-getter|1|122-postInit
            // write post-init user code here
        }//GEN-BEGIN:|122-getter|2|
        return itemCommand1;
    }
    //</editor-fold>//GEN-END:|122-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommandPoisson ">//GEN-BEGIN:|124-getter|0|124-preInit
    /**
     * Returns an initiliazed instance of okCommandPoisson component.
     * @return the initialized component instance
     */
    public Command getOkCommandPoisson() {
        if (okCommandPoisson == null) {//GEN-END:|124-getter|0|124-preInit
            // write pre-init user code here
            okCommandPoisson = new Command("Calcular", Command.OK, 0);//GEN-LINE:|124-getter|1|124-postInit
            // write post-init user code here
        }//GEN-BEGIN:|124-getter|2|
        return okCommandPoisson;
    }
    //</editor-fold>//GEN-END:|124-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: helpCommandPoisson ">//GEN-BEGIN:|126-getter|0|126-preInit
    /**
     * Returns an initiliazed instance of helpCommandPoisson component.
     * @return the initialized component instance
     */
    public Command getHelpCommandPoisson() {
        if (helpCommandPoisson == null) {//GEN-END:|126-getter|0|126-preInit
            // write pre-init user code here
            helpCommandPoisson = new Command("Ajuda", Command.HELP, 0);//GEN-LINE:|126-getter|1|126-postInit
            // write post-init user code here
        }//GEN-BEGIN:|126-getter|2|
        return helpCommandPoisson;
    }
    //</editor-fold>//GEN-END:|126-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: formPoisson ">//GEN-BEGIN:|118-getter|0|118-preInit
    /**
     * Returns an initiliazed instance of formPoisson component.
     * @return the initialized component instance
     */
    public Form getFormPoisson() {
        if (formPoisson == null) {//GEN-END:|118-getter|0|118-preInit
            // write pre-init user code here
            formPoisson = new Form("Distribui\u00E7\u00E3o de Poisson", new Item[] { getTextFieldPoissonLambda(), getTextFieldPoissonK(), getStringItemResultPoisson() });//GEN-BEGIN:|118-getter|1|118-postInit
            formPoisson.addCommand(getOkCommandPoisson());
            formPoisson.addCommand(getHelpCommandPoisson());
            formPoisson.addCommand(getBackCommand1());
            formPoisson.setCommandListener(this);//GEN-END:|118-getter|1|118-postInit
            // write post-init user code here
        }//GEN-BEGIN:|118-getter|2|
        return formPoisson;
    }
    //</editor-fold>//GEN-END:|118-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldPoissonLambda ">//GEN-BEGIN:|119-getter|0|119-preInit
    /**
     * Returns an initiliazed instance of textFieldPoissonLambda component.
     * @return the initialized component instance
     */
    public TextField getTextFieldPoissonLambda() {
        if (textFieldPoissonLambda == null) {//GEN-END:|119-getter|0|119-preInit
            // write pre-init user code here
            textFieldPoissonLambda = new TextField("M\u00E9dia no per\u00EDodo(\u03BB):", null, 32, TextField.ANY);//GEN-LINE:|119-getter|1|119-postInit
            // write post-init user code here
        }//GEN-BEGIN:|119-getter|2|
        return textFieldPoissonLambda;
    }
    //</editor-fold>//GEN-END:|119-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: textFieldPoissonK ">//GEN-BEGIN:|120-getter|0|120-preInit
    /**
     * Returns an initiliazed instance of textFieldPoissonK component.
     * @return the initialized component instance
     */
    public TextField getTextFieldPoissonK() {
        if (textFieldPoissonK == null) {//GEN-END:|120-getter|0|120-preInit
            // write pre-init user code here
            textFieldPoissonK = new TextField("N\u00B0 de Ocorr\u00EAncias esperadas(K):", null, 32, TextField.ANY);//GEN-LINE:|120-getter|1|120-postInit
            // write post-init user code here
        }//GEN-BEGIN:|120-getter|2|
        return textFieldPoissonK;
    }
    //</editor-fold>//GEN-END:|120-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItemResultPoisson ">//GEN-BEGIN:|128-getter|0|128-preInit
    /**
     * Returns an initiliazed instance of stringItemResultPoisson component.
     * @return the initialized component instance
     */
    public StringItem getStringItemResultPoisson() {
        if (stringItemResultPoisson == null) {//GEN-END:|128-getter|0|128-preInit
            // write pre-init user code here
            stringItemResultPoisson = new StringItem("Resultado:", null);//GEN-LINE:|128-getter|1|128-postInit
            // write post-init user code here
        }//GEN-BEGIN:|128-getter|2|
        return stringItemResultPoisson;
    }
    //</editor-fold>//GEN-END:|128-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: alertAjudaPoisson ">//GEN-BEGIN:|138-getter|0|138-preInit
    /**
     * Returns an initiliazed instance of alertAjudaPoisson component.
     * @return the initialized component instance
     */
    public Alert getAlertAjudaPoisson() {
        if (alertAjudaPoisson == null) {//GEN-END:|138-getter|0|138-preInit
            // write pre-init user code here
            alertAjudaPoisson = new Alert("Distribui\u00E7\u00E3o de Poisson - Ajuda", "\u03BB - M\u00E9dia no intervalo; K - N\u00FAmero de eventos esperados. Utilize-a para vari\u00E1veis aleat\u00F3rias discretas onde o intervalo de dados \u00E9 cont\u00EDnuo.", getImage2(), null);//GEN-BEGIN:|138-getter|1|138-postInit
            alertAjudaPoisson.addCommand(getBackCommand6());
            alertAjudaPoisson.setCommandListener(this);
            alertAjudaPoisson.setTimeout(Alert.FOREVER);//GEN-END:|138-getter|1|138-postInit
            // write post-init user code here
        }//GEN-BEGIN:|138-getter|2|
        return alertAjudaPoisson;
    }
    //</editor-fold>//GEN-END:|138-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image2 ">//GEN-BEGIN:|139-getter|0|139-preInit
    /**
     * Returns an initiliazed instance of image2 component.
     * @return the initialized component instance
     */
    public Image getImage2() {
        if (image2 == null) {//GEN-END:|139-getter|0|139-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|139-getter|1|139-@java.io.IOException
                image2 = Image.createImage("/poisson.png");
            } catch (java.io.IOException e) {//GEN-END:|139-getter|1|139-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|139-getter|2|139-postInit
            // write post-init user code here
        }//GEN-BEGIN:|139-getter|3|
        return image2;
    }
    //</editor-fold>//GEN-END:|139-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand6 ">//GEN-BEGIN:|141-getter|0|141-preInit
    /**
     * Returns an initiliazed instance of backCommand6 component.
     * @return the initialized component instance
     */
    public Command getBackCommand6() {
        if (backCommand6 == null) {//GEN-END:|141-getter|0|141-preInit
            // write pre-init user code here
            backCommand6 = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|141-getter|1|141-postInit
            // write post-init user code here
        }//GEN-BEGIN:|141-getter|2|
        return backCommand6;
    }
    //</editor-fold>//GEN-END:|141-getter|2|



    /**
     * Returns a display instance.
     * @return the display instance.
     */
    public Display getDisplay () {
        return Display.getDisplay(this);
    }

    /**
     * Exits MIDlet.
     */
    public void exitMIDlet() {
        switchDisplayable (null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    /**
     * Called when MIDlet is started.
     * Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.
     */
    public void startApp() {
        if (midletPaused) {
            resumeMIDlet ();
        } else {
            initialize ();
            startMIDlet ();
        }
        midletPaused = false;
    }

    /**
     * Called when MIDlet is paused.
     */
    public void pauseApp() {
        midletPaused = true;
    }

    /**
     * Called to signal the MIDlet to terminate.
     * @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.
     */
    public void destroyApp(boolean unconditional) {
    }

    void calculaValorZRetaNormal(){
        double result = Estatistica.valorZ(Double.parseDouble(this.textFieldX.getString()),
                           Double.parseDouble(this.textFieldP.getString()),
                           Double.parseDouble(this.textFieldMiu.getString()),
                           Double.parseDouble(this.textFieldDP.getString()));
        this.stringItemResult.setText(Double.toString(result) + " em Z");
    }

    void calculaDistribuicaoBinomial(){
        double result = Estatistica.distribuicaoBinomial(
                            Integer.parseInt(this.textFieldN.getString()),
                            Integer.parseInt(this.textFieldK.getString()),
                            Double.parseDouble(this.textFieldP1.getString()),
                            Double.parseDouble(this.textFieldQ.getString()));
        this.stringItemResult1.setText(Double.toString(result) + " %");
    }

    void calculaPoisson() {
        double result = Estatistica.distribuicaoDePoisson(
                Integer.parseInt(this.textFieldPoissonLambda.getString()),
                Double.parseDouble(this.textFieldPoissonK.getString()));
        this.stringItemResultPoisson.setText(Double.toString(result) + " %");
    }

}
